# -*- coding: utf-8 -*-
import scrapy
from urllib import parse

class RrloginSpider(scrapy.Spider):
    name = 'rrlogin'
    allowed_domains = ['www.renren.com']
    start_urls = ['http://www.renren.com/PLogin.do']
    def start_requests(self):
        data={
            'email': '13661253075',
            'icode':'',
            'origURL':'http://www.renren.com/home',
            'domain': 'renren.com',
            'key_id': '1',
            'captcha_type': 'web_login',
            'password': '20bec4591eb6a401982242fdaf532bde448985d36d03882ad5226edab9c5a46d',
            'rkey': 'f9c9f835090cb50f1679ed6f02f2bfe8',
            'f': 'http%3A%2F%2Fwww.renren.com%2F966251459',
        }
        headers={'Content-Length':len(data),'User-Agent':'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.104 Safari/537.36 Core/1.53.3538.400 QQBrowser/9.7.12954.400'}
        #data=parse.urlencode(data)
        return [scrapy.FormRequest(
            'http://www.renren.com/ajaxLogin/login?1=1&uniqueTimestamp=2018501613279',
            formdata=data,
            headers=headers,
        )]
    def parse(self, response):
        print(response)